#include "InstructionFactory.hpp"

#include <cstddef>

#include "Logger.hpp"

#include "IfThen.hpp"
#include "IfThenElse.hpp"
#include "For.hpp"
#include "While.hpp"
#include "Repeat.hpp"
#include "Affectation.hpp"
#include "Bloc.hpp"
#include "Output.hpp"
// #include "Input.hpp"

Instruction*
InstructionFactory::generateIfThen ( Expression* condition, Instruction* codeAlors )
{
    LOGFUNCTION ( IFACT_LOG );
    return new IfThen(condition, codeAlors);
}

Instruction*
InstructionFactory::generateIfThenElse ( Expression* condition, Instruction* codeAlors, Instruction* codeSinon )
{
    LOGFUNCTION ( IFACT_LOG );
    return new IfThenElse(condition, codeAlors, codeSinon);
}

Instruction*
InstructionFactory::generateFor ( Instruction* initialisation, Expression* condition, Instruction* increment, Instruction* codeBoucle )
{
    LOGFUNCTION ( IFACT_LOG );
    return new For(initialisation, condition, increment, codeBoucle);
}

Instruction*
InstructionFactory::generateWhile ( Expression* condition, Instruction* codeBoucle )
{
    LOGFUNCTION ( IFACT_LOG );
    return new While(condition, codeBoucle);
}

Instruction*
InstructionFactory::generateRepeat ( Expression* condition, Instruction* codeBoucle )
{
    LOGFUNCTION ( IFACT_LOG );
    return new Repeat(condition, codeBoucle);
}

Instruction*
InstructionFactory::generateAffectation ( Expression* aGauche, Expression* aDroite )
{
    LOGFUNCTION ( IFACT_LOG );
    return new Affectation(aGauche,aDroite);
}

Instruction*
InstructionFactory::generateBloc ( std::vector < Instruction* > listeInstruction )
{
    LOGFUNCTION ( IFACT_LOG );
    return new Bloc(listeInstruction);
}

Instruction*
InstructionFactory::generateOutput ( std::vector < Expression* > listeExpression )
{
    LOGFUNCTION ( IFACT_LOG );
    return new Output ( listeExpression );
}

Instruction*
InstructionFactory::generateInput ( std::vector < Expression* > listeExpression )
{
    LOGFUNCTION ( IFACT_LOG );
    return NULL;
}

Instruction*
InstructionFactory::generateCall ( const std::string& name, std::vector < Expression* > listeExpression )
{
    LOGFUNCTION ( IFACT_LOG );
    return NULL;
}

Instruction*
InstructionFactory::generateReturn ( Expression* aDroite )
{
    LOGFUNCTION ( IFACT_LOG );
    return NULL;
}
